@extends('frontend/layouts/default')

@section('content')

<h1>All MasterCode</h1>

<p>{{ link_to_route('acc.master.code.create', 'Add new MasterCode', null, array('class' => 'btn btn-info')) }}</p>
<!--
@if ($master_codes->count())
<table class="table table-striped table-bordered">
    <thead>
        <tr>
<th>Domain</th>
<th>Id</th>
<th>Code</th>
<th>Balance</th>
<th>Element</th>
<th>Name</th>
<th>Sname</th>
<th>Lname</th>
<th>Uname</th>
<th>Spell</th>
<th>Type</th>
<th>Abstract</th>
<th>Cvp_type</th>
<th>Calclute_type</th>
<th>Tax_debt</th>
<th>Tax_credit</th>
<th>Memo</th>
<th>Node_parent</th>
<th>Node_left</th>
<th>Node_right</th>
<th>Node_depth</th>
<th>Node_flag</th>
<th> Action  </th>
        </tr>
    </thead>
    <tbody>
        @foreach ($master_codes as $masterCode)
        <tr>
<td>{{ $masterCode->domain }}</td>
<td>{{ $masterCode->id }}</td>
<td>{{ $masterCode->code }}</td>
<td>{{ $masterCode->balance }}</td>
<td>{{ $masterCode->element }}</td>
<td>{{ $masterCode->name }}</td>
<td>{{ $masterCode->sname }}</td>
<td>{{ $masterCode->lname }}</td>
<td>{{ $masterCode->uname }}</td>
<td>{{ $masterCode->spell }}</td>
<td>{{ $masterCode->type }}</td>
<td>{{ $masterCode->abstract }}</td>
<td>{{ $masterCode->cvp_type }}</td>
<td>{{ $masterCode->calclute_type }}</td>
<td>{{ $masterCode->tax_debt }}</td>
<td>{{ $masterCode->tax_credit }}</td>
<td>{{ $masterCode->memo }}</td>
<td>{{ $masterCode->node_parent }}</td>
<td>{{ $masterCode->node_left }}</td>
<td>{{ $masterCode->node_right }}</td>
<td>{{ $masterCode->node_depth }}</td>
<td>{{ $masterCode->node_flag }}</td>
<td>  
{{ Form::open(array('method' => 'DELETE', 'route' => array('acc.master.code.destroy', $masterCode->getJointPk()))) }} 
{{ link_to_route('acc.master.code.edit', 'Edit', $masterCode->getJointPk(), array('class' => 'btn btn-info')) }} &nbsp;&nbsp;
{{ link_to_route('acc.master.code.show', 'Show', $masterCode->getJointPk(), array('class' => 'btn btn-primary')) }} &nbsp;&nbsp;
{{ link_to_route('acc.master.code.up', 'Up', $masterCode->getJointPk(), array('class' => 'btn btn-primary')) }} &nbsp;&nbsp;
{{ link_to_route('acc.master.code.down', 'Down', $masterCode->getJointPk(), array('class' => 'btn btn-primary')) }} &nbsp;&nbsp;
{{ link_to_route('acc.master.code.down', 'Delete', $masterCode->getJointPk(), array('class' => 'btn btn-primary btn-danger', 'data-method' => 'DELETE')) }}
</td>
        </tr>
        @endforeach
    </tbody>
</table>
@else
    There are no master_codes
@endif
-->

<div class="container">
    <h4>master_codes tree</h4>
    <div id="tree-master_codes-view"></div>
</div>
<button id="refresh">Refresh master_codes</button>

@stop

@section('pagestyles')
    <link rel="stylesheet" href="{{ asset('assets/tree/backbone-treeview.css') }}" />
@stop

@section('pagescripts')

<script type="text/template" id = "tree-master_codes-template">
<span class="node-collapse"> 
    <span class="node-label"><%- name %></span>
    <span class="node-data">
        id:<%- pkey %> parent:<%- node_parent %> left:<%- node_left %> right:<%- node_right %> depth:<%- node_depth %>
    </span>
    <span class="node-action pull-right">
        <a class="btn btn-mini btn-info" href="{{URL::current()}}/<%- pkey %>/edit">Edit</a>
        <a class="btn btn-mini btn-primary" href="{{URL::current()}}/<%- pkey %>">Show</a>
        <a class="btn btn-mini btn-primary" href="{{URL::current()}}/<%- pkey %>/up" >Up</a>
        <a class="btn btn-mini btn-primary" href="{{URL::current()}}/<%- pkey %>/down" >Down</a>
        <a class="btn btn-mini btn-danger" href="{{URL::current()}}/<%- pkey %>" data-method="DELETE">Delete</a>
    </span>
</span>

</script>
<script src="{{ asset('assets/tree/backbone-treeview.js') }}"></script>
<script src="{{ asset('assets/bq/linksubmit.js') }}"></script>
<script type="text/javascript">
(function(){
var treeMasterCodeCollection = new Backbone.TreeNodeCollection( {{$jsonMasterCode}} );
var treeMasterCodeCollectionView = new Backbone.TreeNodeCollectionView({
    collection: treeMasterCodeCollection,
    nodetemplate: '#tree-master_codes-template',
    nodeid : null});
$('#tree-master_codes-view').html(treeMasterCodeCollectionView.render().el);
})();
</script>

@stop

